﻿using System;
using System.Linq;
using WebExam.DataEntities;

namespace WebExam.DataProvider
{
    public interface IGGRepository
    {
        /// <summary>
        /// 获取公告信息
        /// </summary>
        /// <param name="start">开始位置</param>
        /// <param name="takeSize">获取条数</param>
        IQueryable<GG> GetAll(int start, int takeSize);

        /// <summary>
        /// 获取前n条公告信息
        /// </summary>
        /// <param name="takeSize">获取条数</param>
        IQueryable<GG> GetTop(int takeSize);

        /// <summary>
        /// 获取公告信息
        /// </summary>
        /// <param name="ggId">公告Id</param>
        GG Get(int ggId);

        /// <summary>
        /// 添加公告信息
        /// </summary>
        /// <param name="gg">公告对象</param>
        GG Add(GG gg);

        /// <summary>
        /// 更新公告信息
        /// </summary>
        /// <param name="ggId">公告Id</param>
        /// <param name="update">包含更新操作的方法</param>
        GG Update(int ggId, Action<GG> update);

        /// <summary>
        /// 删除公告信息
        /// </summary>
        /// <param name="ggId">公告Id</param>
        bool Delete(int ggId);

        /// <summary>
        /// 统计公告条数
        /// </summary>
        int Count();
    }
}